<template>
    <div class="demo">
        <h2 >学校名称:{{name}}</h2>
        <h2 >学校地址:{{address}}</h2>
        <button @click="sendSchoolName">学校的名字给学生</button>
    </div>
</template>

<script>
import pubsub from 'pubsub-js'
export default {
    name:'School',
    data() {
        return {
            name:'清华',
            address:'济南'
        }
    },
    methods: {
        sendSchoolName(){
            // this.$bus.$emit('schoolName',this.name)
            pubsub.publish('xxx',this.name)
        }
    },
}
</script>

<style lang="css" scoped>
    .demo{
        background-color: aqua;
        padding: 5px;
        margin-top: 5px;
    }
</style>
